
/* eslint-disable */
<template>
	<div class="sysSetting">
		<div class="userCollapse" >
			<el-form class='searchform' :inline="true" :model="form" ref="form" label-width="140px">
				<el-row>
					<el-col :span="24" class="flex flex-vc rowItem">
						<el-button  @click="showcollse=!showcollse" class="showsearchBtn" type="info"
							 :icon="showcollse?'el-icon-caret-top':'el-icon-caret-bottom'"  size="mini" >{{showcollse?$t('common.collseHide'):$t('common.spread')}}</el-button>
						<span class="searchTitle flex-vc inline_flex flex-hc">{{$t('searchEaraLabel.resource')}}</span>
						<div class="userCollapse_item" v-if="showcollse">
							<el-form-item :label="$t('common.resourceName')+'：'">
								<el-input v-model="form.resourceName" :placeholder="$t('common.inputPlaceholder')"></el-input>
							</el-form-item>
				    		<el-form-item :label="$t('common.resourceCode')+'：'">
								<el-input v-model="form.resourceCode" :placeholder="$t('common.inputPlaceholder')"></el-input>
							</el-form-item>
							<el-form-item :label="$t('common.resourceStatus')+'：'">
								<el-select v-model="form.status" :placeholder="$t('common.selectPlaceholder')"  >
									<el-option v-for="(item,index) in statusDic" :key="index" :label="item.label" :value="item.value"></el-option>
								</el-select>
							</el-form-item>
							<el-form-item :label="$t('common.shareFlag')+'：'">
								<el-select v-model="form.shareFlag" :placeholder="$t('common.selectPlaceholder')"  clearable>
									<el-option v-for="(item,index) in selectSection" :key="index" :label="item.label" :value="item.value"></el-option>
								</el-select>
							</el-form-item>
							<el-form-item :label="$t('common.paramType')+'：'">
								<el-select v-model="form.paramType" :placeholder="$t('common.selectPlaceholder')"  clearable>
									<el-option v-for="(item,index) in paramTypeDic" :key="index" :label="item.label" :value="item.value"></el-option>
								</el-select>
							</el-form-item>
							<el-form-item :label="$t('common.paramStruct')+'：'">
								<el-select v-model="form.paramStruct" :placeholder="$t('common.selectPlaceholder')"  clearable>
									<el-option :label="$t('modules.resourceManage.list')" :value="0"></el-option>
									<el-option :label="$t('modules.resourceManage.tree')" :value="1"></el-option>
								</el-select>
							</el-form-item>
						</div>
						<div class="userCollapse_hide" v-if="!showcollse">
							<span>{{$t('common.resourceName')}}:</span><strong>【{{form.resourceName?form.resourceName:$t('common.all')}}】</strong>
							<span>{{$t('common.resourceCode')}}:</span><strong>【{{form.resourceCode?form.resourceCode:$t('common.all')}}】</strong>
							<span>{{$t('common.resourceStatus')}}:</span><strong>【{{getSearchAreaName('status')}}】</strong>
							<span>{{$t('common.shareFlag')}}:</span><strong>【{{getSearchAreaName('shareFlag')}}】</strong>
							<span>{{$t('common.paramType')}}:</span><strong>【{{getSearchAreaName('paramType')}}】</strong>
							<span>{{$t('common.paramStruct')}}:</span><strong>【{{form.paramStruct!==''?(form.paramStruct==0?'列表':'树形'):$t('common.all')}}】</strong>
						</div>
					</el-col>

				</el-row>
			</el-form>

		</div>
		<el-row>
			<el-col :span="18">
				<div class="operateBtn">
					<el-button  @click="beforeupdate(2)" >{{$t('modules.resourceManage.paramDetail')}}</el-button>
					<el-button  @click="beforeupdate(0)" >{{$t('modules.resourceManage.add')}}</el-button>
					<el-button  @click="beforeupdate(1)" >{{$t('modules.resourceManage.modify')}}</el-button>
					<el-button  @click="batchDisabled">{{$t('modules.resourceManage.statusChoice')}}</el-button>
				<!--	<el-button  @click="testVisible=!testVisible">测试用</el-button>-->
				</div>
			</el-col>
			<el-col :span="6">
				<div class="searchBtn">
					<el-button type="primary" @click="onSearch" >{{$t('common.searchBtn')}}</el-button>
					<el-button type="primary" @click="resetSearch" >{{$t('common.resetBtn')}}</el-button>
				</div>
			</el-col>
		</el-row>
		<!--资源信息列表-->
		<el-table class="data-list "  v-loading="loadind" ref="multipleTable" :data="dataList" border @selection-change="selectChange" @row-dblclick="update" highlight-current-row  >
			<el-table-column  type="selection" width="55"></el-table-column>
			<el-table-column v-for="item in tableVisibleArr" :key="item.prop" :prop="item.prop" :label="item.label"  align="center"  show-overflow-tooltip :formatter="formatter"></el-table-column>
		</el-table>
		<div class="tablebottom" style="position:relative;">
			<el-pagination
		      @size-change="pageSizeChange"
		      @current-change="handleCurrentChangePage"
		      :current-page="pagination.pageNum"
		      :page-sizes="[10,20, 50, 100, 200]"
		      :page-size="pagination.pageSize"
		      layout="->,prev, pager, next, jumper, sizes,total"
		      :total="pagination.totalSize">
		    </el-pagination>
		    <!-- 自定义表格字段组件 -->
		    <defined-table storageName="basp_resourceManage" :headArr="headArr" :selectArr="tableVisibleArr" @saveAutoDefinedTable="saveAutoDefinedTable"></defined-table>
		</div>

		<!--新增修改-->
		<el-dialog class="newlyForm" :title="title" :visible.sync="newlyFormVisible"  width="50%" @close="closeDialog" :close-on-click-modal="false">
			<el-row>
			    <el-col :span="22">
			  		<el-form :rules="rules"  :inline="false" :model="resourceInfoForm" ref="resourceInfoForm" label-width="200px">
						<!--<el-form-item label="资源ID："  >
							<el-input :disabled="true" v-model="resourceInfoForm.resourceId" placeholder="系统自动生成"></el-input>
						</el-form-item>-->
						<el-form-item :label="$t('common.resourceCode')+'：'" prop="resourceCode">
							<el-input :disabled="title==$t('modules.resourceManage.modifyResource')" v-model="resourceInfoForm.resourceCode" placeholder="请填写"></el-input>
						</el-form-item>
						<el-form-item :label="$t('common.resourceName')+'：'" prop="resourceName">
							<el-input :maxlength="128" @change="resourceInfoForm.resourceName=$checkTextValidate(resourceInfoForm.resourceName)"  v-model="resourceInfoForm.resourceName" :placeholder="$t('common.inputPlaceholder')"></el-input>
						</el-form-item>
						<el-form-item :label="$t('common.resourceDesc')+'：'" prop="resourceDesc">
							<el-input type="textarea" :maxlength="128"  @change="resourceInfoForm.resourceDesc=$checkTextValidate(resourceInfoForm.resourceDesc)"  :rows="2"  v-model="resourceInfoForm.resourceDesc" :placeholder="$t('common.inputPlaceholder')"></el-input>
						</el-form-item>
						<el-form-item :label="$t('common.shareFlag')+'：'" prop="shareFlag">
							<el-select  v-model="resourceInfoForm.shareFlag" :placeholder="$t('common.selectPlaceholder')"  >
								<el-option v-for="(item,index) in selectSection" :key="index" :label="item.label" :value="item.value"></el-option>
							</el-select>
						</el-form-item>
						<el-form-item label="ETL_ID：" >
							<el-input :maxlength="128" @change="resourceInfoForm.etlResourceId=$getTextNumber(resourceInfoForm.etlResourceId)"  v-model="resourceInfoForm.etlResourceId" :placeholder="$t('common.inputPlaceholder')"></el-input>
						</el-form-item>
						<el-form-item :label="$t('common.paramType')+'：'"  prop="paramType">
							<el-select :disabled="title==$t('modules.resourceManage.modifyResource')"  v-model="resourceInfoForm.paramType" :placeholder="$t('common.selectPlaceholder')"  >
								<el-option @click.native="resourceInfoForm.paramStruct = item.paramStruct"  :key="index" :label="item.label" :value="item.value" v-for="(item,index) in paramTypeDic"></el-option>
							</el-select>
						</el-form-item>
						<el-form-item v-if="resourceInfoForm.paramType==0" :label="$t('modules.resourceManage.thirdPartyServeUrl')+'：'" prop="paramUrl">
							<el-select @change="resourceInfoForm.paramUrl=$checkTextValidate(resourceInfoForm.paramUrl)"  v-model="resourceInfoForm.paramUrl" :placeholder="$t('common.inputPlaceholder')"  filterable  :filter-method="searchParamUrl">
								<el-option @click.native="resourceInfoForm.paramStruct = item.paramStruct?item.paramStruct :0" v-for="item in paramUrlSelectSection" :key="item.wsdlId" :label="item.wsdlName" :value="item.wsdlId+''"></el-option>
							</el-select>
						</el-form-item>
						<el-form-item :label="$t('common.paramStruct')+'：'" prop="paramStruct" v-if="title==$t('modules.resourceManage.modifyResource')">
							<el-select  :disabled="title==$t('modules.resourceManage.modifyResource')" v-model="resourceInfoForm.paramStruct" :placeholder="$t('common.selectPlaceholder')"  >
								<el-option :label="$t('modules.resourceManage.list')" :value="0"></el-option>
								<el-option :label="$t('modules.resourceManage.tree')" :value="1"></el-option>
							</el-select>
						</el-form-item>
						<el-form-item :label="$t('modules.resourceManage.hasDatagroup')+'：'"  prop="hasDatagroup">
							<el-select  v-model="resourceInfoForm.hasDatagroup" :placeholder="$t('common.selectPlaceholder')"  >
								<el-option v-for="(item,index) in selectSection" :key="index" :label="item.label" :value="item.value"></el-option>
							</el-select>
						</el-form-item>
						<el-form-item :label="$t('modules.resourceManage.supportMultiDatagroup')+'：'"  prop="supportMultiDatagroup">
							<el-select  v-model="resourceInfoForm.supportMultiDatagroup" :placeholder="$t('common.selectPlaceholder')"  >
								<el-option v-for="(item,index) in selectSection" :key="index" :label="item.label" :value="item.value"></el-option>
							</el-select>
						</el-form-item>
						<el-form-item :label="$t('modules.resourceManage.customDatagroup')+'：'"  prop="customDatagroup">
							<el-select  v-model="resourceInfoForm.customDatagroup" :placeholder="$t('common.selectPlaceholder')"  >
								<el-option v-for="(item,index) in selectSection" :key="index" :label="item.label" :value="item.value"></el-option>
							</el-select>
						</el-form-item>
					</el-form>
                </el-col>
			</el-row>
			<div slot="footer" class="dialog-footer">
				<el-button @click="giveupFun('newlyFormVisible')">{{$t('common.giveUp')}}</el-button>
				<el-button type="primary" @click="submitForm">{{$t('common.save')}}</el-button>
			</div>
		</el-dialog>
		<!--主数据明细查询,mainRow是选中行-->
		<dataSource-detail :visible="mainDataSourceVisible" :mainRow="multipleSelection[0]" @dataSourceDetailClose="mainDataSourceVisible=false"  ></dataSource-detail>
	</div>
</template>
<script>
import definedTable from "../components/definedTable"
import dataSourceDetail from "../components/dataSourceDetail"
import {
    Message, Notification, MessageBox, Loading
} from 'element-ui'
export default {
		name: 'resourceManage',
    components: {
        dataSourceDetail, definedTable
    },
    data () {
        return {
            testVisible: false,
            mainDataSourceVisible: false,
            showcollse: false,
            form: {
                ownerSysId: '',
                resourceCode: '',
                resourceName: '',
                status: 1,
                shareFlag: '',
                paramType: '',
                paramStruct: ''
            },
            resourceInfoForm: {
                resourceId: '',
                resourceCode: '',
                resourceName: '',
                resourceDesc: '',
                resourceType: '',
                shareFlag: '',
                paramType: '',
                paramUrl: '',
                paramStruct: '',
                hasDatagroup: '',
                supportMultiDatagroup: '',
                customDatagroup: '',
                ownerSysName: '',
                etlResourceId: ''
            },
            rules: {
		        resourceCode: [
		            { required: true, message: this.$t('validateWornText.inputResourceCode'), trigger: 'blur' }
		        ],
                resourceName: [
		            { required: true, message: this.$t('validateWornText.inputResourceName'), trigger: 'blur' }
		        ],
		        paramUrl: [
		            { required: true, message: this.$t('validateWornText.inputParamUrl'), trigger: 'blur' }
		        ],
                shareFlag: [
		            { required: true, message: this.$t('validateWornText.selectShareFlag'), trigger: 'change' }
		        ],
                paramType: [
		            { required: true, message: this.$t('validateWornText.selectParamType'), trigger: 'change' }
		        ],
		         paramStruct: [
		            { required: true, message: this.$t('validateWornText.selectParamStruct'), trigger: 'change' }
		        ],
		        hasDatagroup: [
		            { required: true, message: this.$t('validateWornText.hasDatagroup'), trigger: 'change' }
		        ],
		        supportMultiDatagroup: [
		            { required: true, message: this.$t('validateWornText.supportMultiDatagroup'), trigger: 'change' }
		        ],
		        customDatagroup: [
		            { required: true, message: this.$t('validateWornText.customDatagroup'), trigger: 'change' }
		        ]
            },
            selectSection: [{ value: 0, label: this.$t('common.not') }, { value: 1, label: this.$t('common.is') }],
			paramTypeDic:[
				{value:0,label:this.$t('modules.resourceManage.thirdParty'),paramStruct:'0'},
				{value:1,label:this.$t('modules.resourceManage.netAsrua'),paramStruct:'1'},
				{value:2,label:this.$t('modules.resourceManage.warehouse'),paramStruct:'0'},
				{value:3,label:this.$t('modules.resourceManage.shipper'),paramStruct:'0'},
				{value:4,label:this.$t('modules.resourceManage.monthlyCustomer'),paramStruct:'0'},
				{value:5,label:this.$t('modules.resourceManage.companyAccount'),paramStruct:'0'},
				{value:6,label:this.$t('modules.resourceManage.orgSap'),paramStruct:'1'},
				{value:7,label:this.$t('modules.resourceManage.supplier'),paramStruct:'0'},
				{value:8,label:this.$t('modules.resourceManage.industryCode'),paramStruct:'0'},
				{value:9,label:this.$t('modules.resourceManage.empCodeSasp'),paramStruct:'0'},
				{value:10,label:this.$t('modules.resourceManage.localSQl'),paramStruct:'0'},
				{value:11,label:this.$t('modules.resourceManage.close_typeCompany'),paramStruct:'1'},
			],
            statusDic: [
                { value: 1, label: (window.sessionStorage.getItem('lang') === 'zh-CN') ? "启用" : 'enabled' },
			    { value: 0, label: (window.sessionStorage.getItem('lang') === 'zh-CN') ? "禁用" : 'disabled' }
            ], // 状态字典
            pagination: {
                totalSize: 0,
                pageSize: 10,
                pageNum: 1,
                totalPage: 0
            },
            dataList: [],
            loadind: false,
            multipleSelection: [],
            chooseSelectionArr: [],
            newlyFormVisible: false,
            title: '',
            headArr: [
                { prop: "resourceId", label: this.$t('common.resourceId'), index: 0 },
                { prop: "resourceCode", label: this.$t('common.resourceCode'), index: 1 },
                { prop: "resourceName", label: this.$t('common.resourceName'), index: 2 },
                { prop: "resourceDesc", label: this.$t('common.resourceDesc'), index: 3 },
                { prop: "status", label: this.$t('common.resourceStatus'), index: 4 },
                { prop: "shareFlag", label: this.$t('common.shareFlag'), index: 5 },
                { prop: "ownerSysName", label: this.$t('common.ownerSysName'), index: 6 },
                { prop: "lastUpdator", label: this.$t('common.lastUpdator'), index: 7 },
                { prop: "lastUpdateTm", label: this.$t('common.lastUpdateTm'), index: 8 },
                { prop: "creator", label: this.$t('common.creator'), index: 9 },
                { prop: "createTm", label: this.$t('common.createTm'), index: 10 }
            ],
            tableVisibleArr: [],
            systemInfo: {},
            systemId: '',
	    	paramUrlSelectSection:[]		
        }
    },
    beforeCreate () {
    },
    mounted () {
    	var pageObj = localStorage.getItem('basp_resourceManage') // 捞出缓存中的该页面的表格配置
    	if (pageObj) {
            var obj = JSON.parse(pageObj)
    		if (sessionStorage.getItem('userName')) {
    			this.saveAutoDefinedTable(obj[sessionStorage.getItem('userName')])
    		} else {
    			this.tableVisibleArr = this.$deepCopy(this.headArr, [])
    		}
    	} else {
    		this.tableVisibleArr = this.$deepCopy(this.headArr, [])
        }
        this.searchSystemInfo()
        this.searchHttp()
    },
    methods: {
    	async searchSystemInfo(){
    		this.systemInfo = await this.$getSystemInfo()
    		this.systemId = this.systemInfo.systemId
    	},
        saveAutoDefinedTable (arr) { // 配置表格可见的选项
            var temp = []
            for (var i = 0; i < arr.length; i++) {
                temp.push(this.headArr[arr[i]])
            }
            this.tableVisibleArr = temp
        },
        selectChange (val) {
            this.multipleSelection = val
	},
	searchParamUrl(val){
		if (/^[\u4e00-\u9fa5]/g.test(val) || /^\S{3,}$/.test(val) || val==''){
			var that=this
			var urlH='/dev-basp-system/resource/queryParamUrlList'
			var param={
				wsdlName:val,
				pageSize:10,
				pageNum:1,
			}
			this.$httpExt().post(urlH, param)
			.then((response) => {
				that.paramUrlSelectSection=response.result.data||[];
			}, (response) => {
				Notification.error({
					title: '异常',
					message: response.msg? response.msg:'系统异常，请联系管理员！'
				});
			});
		}
        },
        searchHttp () {
            var param = {
                ownerSysId: this.form.ownerSysId,
                resourceCode: this.form.resourceCode,
                resourceName: this.form.resourceName,
                resourceStatus: this.form.status,
                shareFlag: this.form.shareFlag,
                paramType: this.form.paramType,
                paramStruct: this.form.paramStruct,
                pageSize: this.pagination.pageSize,
                pageNum: this.pagination.pageNum
            }
            this.loadind = true
            var that = this
            this.$httpExt().post('/dev-basp-system/resource/queryList', param)
                .then((response) => {
                    this.loadind = false
                    var body = response.result
                    this.pagination.totalSize = body.totalSize
                    this.dataList = body.data
                    var tempSelectCurrent = []
                    if (that.chooseSelectionArr.length > 0) {
                        for (var i = 0; i < that.dataList.length; i++) {
                            for (var k = 0; k < that.chooseSelectionArr.length; k++) {
                                var id1 = that.chooseSelectionArr[k].resourceId
                                var id2 = that.dataList[i].resourceId
                                if (id1 === id2) {
                                    tempSelectCurrent.push(that.dataList[i])
                                    that.chooseSelectionArr.splice(k, 1)
                                    break
                                }
                            }
                        }
                    }
                    this.$nextTick(() => {
                        that.toggleSelection(tempSelectCurrent)
                    })
                }, (response) => {
                    this.loadind = false
                    Notification.error({
                        title: this.$t('common.exception'),
                        message: response.msg ? response.msg : this.$t('common.exceptionWornText')
                    })
                })
        },
        toggleSelection (rows) {
            if (rows.length) {
	          rows.forEach(row => {
	            this.$refs["multipleTable"].toggleRowSelection(row)
	          })
	        } else {
	          this.$refs["multipleTable"].clearSelection()
	        }
	    },
        handleCurrentChangePage (val) {
            this.chooseSelectionArr = this.chooseSelectionArr.concat(this.multipleSelection)
            this.pagination.pageNum = val
            this.searchHttp()
        },
        pageSizeChange (val) {
            this.chooseSelectionArr = this.chooseSelectionArr.concat(this.multipleSelection)
            this.pagination.pageNum = 1
            this.pagination.pageSize = val
            this.searchHttp()
        },
        resetSearch () {
            // 重置搜索域
            this.form = {
                ownerSysId: '',
                resourceCode: '',
                resourceName: '',
                status: 1,
                shareFlag: '',
                paramType: '',
                paramStruct: ''
            }
        },
        onSearch () {
            this.multipleSelection = []// 清空当前页面勾选项
            this.chooseSelectionArr = []// 清空页面所有勾选项
            this.pagination.pageNum = 1
            this.searchHttp()
        },
        batchDisabled () {
            let tempAllselectData = this.$deepCopy(this.chooseSelectionArr, [])
            tempAllselectData = tempAllselectData.concat(this.multipleSelection)
            if (tempAllselectData.length > 0) {
                let text
                if (tempAllselectData[0].status === 1) {
                    text = this.$t('modules.resourceManage.disabledTip')
                } else {
                    text = this.$t('modules.resourceManage.confirmEnable')
                }
                this.$confirm(text, this.$t('common.tip'), {
                    confirmButtonText: this.$t('common.submitOption'),
                    cancelButtonText: this.$t('common.cancelOption')
                }).then(() => {
                    let urlH = '/dev-basp-system/resource/state'
                    let loadingInstance = Loading.service({ fullscreen: true })
                    var param = []
                    for (var i = 0; i < tempAllselectData.length; i++) {
                        param.push({
                            resourceId: tempAllselectData[i].resourceId,
                            status: tempAllselectData[0].status === 1 ? 0 : 1
                        })
                    }
                    var that = this
                    this.$httpExt().post(urlH, param)
                        .then((response) => {
                            that.onSearch()
                            loadingInstance.close()
                        }, (response) => {
                            loadingInstance.close()
                            Notification.error({
                                title: this.$t('common.exception'),
                                message: response.msg ? response.msg : this.$t('common.exceptionWornText')
                            })
                        })
		        }).catch(() => {
		        })
            } else {
                MessageBox({
                    message: (window.sessionStorage.getItem('lang') === 'zh-CN') ? '请至少选择一条数据进行操作!' : 'Please select at least one data for operation!',
                    confirmButtonText: this.$t('common.iknow')
                })
            }
        },
	    closeDialog () { // 关闭新增，修改模态框
	    	this.newlyFormVisible = false
            this.$refs['resourceInfoForm'].resetFields()// 重置表单
            this.resourceInfoForm = {
                resourceId: '',
                resourceCode: '',
                resourceName: '',
                resourceDesc: '',
                shareFlag: '',
                paramType: '',
                paramUrl: '',
                paramStruct: '',
                resourceType: '',
                hasDatagroup: '',
                supportMultiDatagroup: '',
                customDatagroup: '',
                ownerSysName: '',
                etlResourceId: ''
            }
	    },
	    giveupFun (val) {
	    	this.$confirm(this.$t('modules.resourceManage.giveUpEditWornTip'), this.$t('common.tip'), {
	          	confirmButtonText: this.$t('common.submitOption'),
	          	cancelButtonText: this.$t('common.cancelOption')
	        }).then(() => {
	        	this[val] = false
	        }).catch(() => {
	        })
	    },
	    // 修改
	    update (row) {
	    	this.resourceInfoForm = {
	    		resourceId: row.resourceId,
                resourceCode: row.resourceCode,
                resourceName: row.resourceName,
                resourceDesc: row.resourceDesc,
                shareFlag: row.shareFlag,
                resourceType: row.resourceType,
                paramType: row.paramType ? row.paramType : '0',
                paramUrl: row.paramUrl,
                paramStruct: row.paramStruct,
                hasDatagroup: row.hasDatagroup,
                supportMultiDatagroup: row.supportMultiDatagroup,
                customDatagroup: row.customDatagroup,
                ownerSysName: row.ownerSysName,
                etlResourceId: row.etlResourceId
            }
	    	this.newlyFormVisible=true
	    	this.title=this.$t('modules.resourceManage.modifyResource')
	    },
	    submitForm () {
	    	var that = this
	    	this.$refs['resourceInfoForm'].validate((valid) => {
	    		var param = {
                    resourceId: that.resourceInfoForm.resourceId,
                    resourceCode: that.resourceInfoForm.resourceCode,
                    resourceName: that.resourceInfoForm.resourceName,
                    resourceDesc: that.resourceInfoForm.resourceDesc,
                    shareFlag: that.resourceInfoForm.shareFlag,
                    paramType: that.resourceInfoForm.paramType,
                    paramUrl: that.resourceInfoForm.paramUrl,
                    paramStruct: that.resourceInfoForm.paramStruct,
                    hasDatagroup: that.resourceInfoForm.hasDatagroup,
                    supportMultiDatagroup: that.resourceInfoForm.supportMultiDatagroup,
                    customDatagroup: that.resourceInfoForm.customDatagroup,
                    etlResourceId: that.resourceInfoForm.etlResourceId,
                    resourceType: 1
                }
			    if (valid) {
                    var urlH = (this.title === this.$t('modules.resourceManage.modifyResource')) ? '/dev-basp-system/resource/update' : '/dev-basp-system/resource/add'
                    var msg = (this.title === this.$t('modules.resourceManage.modifyResource')) ? this.$t('modules.resourceManage.modifySuccess') : this.$t('modules.resourceManage.addSuccess')
                    let loadingInstance = Loading.service({ fullscreen: true })
                    this.$httpExt().post(urlH, param)
                        .then((response) => {
                            that.newlyFormVisible = false
                            that.onSearch()
                            loadingInstance.close()
                            this.$message({
					          message: response.msg ? response.msg : msg,
					          type: 'success'
					    })
                        }, (response) => {
                            loadingInstance.close()
                            Notification.error({
                                title: this.$t('common.exception'),
                                message: response.msg ? response.msg : this.$t('common.exceptionWornText')
                            })
                        })
			    } else {
			    	return false
                }
            })
	    },
	    // 判断勾选
	    beforeupdate (param) {
	    	if (param === 0) { // 新增
                this.title = this.$t('modules.resourceManage.addNewResource')
                this.newlyFormVisible = true
				this.searchParamUrl('')
            } else if (this.multipleSelection.length > 1) {
                MessageBox({
                    message: (window.sessionStorage.getItem('lang') === 'zh-CN') ? '请选择一条数据进行操作!' : 'Please select only one data for operation!',
                    confirmButtonText: this.$t('common.iknow')
                })
            } else if (this.multipleSelection.length === 1) {
                if (param === 1) {
                    if (this.multipleSelection[0].status === 0) {
                        this.$message({
					        message: this.$t('modules.resourceManage.modifyTip'),
					        type: 'warning'
					    })
                        return
                    }
                    if (this.multipleSelection[0].ownerSysId != this.systemId) {
                        this.$message({
					        message: this.$t('modules.resourceManage.editTip'),
					        type: 'warning'
					    })
                		return
			    	}
					this.searchParamUrl(this.multipleSelection[0].paramUrlName)
					this.update(this.multipleSelection[0]) //修改
				}else if(param==2){
					this.showDataDetail(this.multipleSelection[0]) //查主数据明细
				}
			}else{
				MessageBox({
					message:  (window.sessionStorage.getItem('lang') == 'zh-CN')? '请至少选择一条数据进行操作!':'Please select at least one data for operation!',
					confirmButtonText:  this.$t('common.iknow')
				});
			}
	    },
	    // 主数据明细框
	    showDataDetail (row) {
	    	this.mainDataSourceVisible = true
	    },
	    getSearchAreaName (val) {
		   	switch (val) {
                case "status":
                    for (let c = 0; c < this.statusDic.length; c++) {
                        if (this.form.status === this.statusDic[c].value) {
                            return this.statusDic[c].label
                        }
                    }
                    return this.$t('common.all')
                case "shareFlag":
                    for (let e = 0; e < this.selectSection.length; e++) {
                        if (this.form.shareFlag === this.selectSection[e].value) {
                            return this.selectSection[e].label
                        }
                    }
                    return this.$t('common.all')
                case "paramType":
                    for (let e = 0; e < this.paramTypeDic.length; e++) {
                        if (this.form.paramType === this.paramTypeDic[e].value) {
                            return this.paramTypeDic[e].label
                        }
                    }
                    return this.$t('common.all')
                default : return this.form[val]; 
		   	}
	    },
	    formatter (row, column) { // 状态信息中表格展开项的code转为name
            switch (column.property) {
                case "status":// 资源状态
                    for (var i = 0; i < this.statusDic.length; i++) {
                        if (row.status === this.statusDic[i].value) {
                            return this.statusDic[i].label
                        }
                    }
                    return row.status
                case "shareFlag":// 授权状态
                    for (var a = 0; a < this.selectSection.length; a++) {
                        if (row.shareFlag === this.selectSection[a].value) {
                            return this.selectSection[a].label
                        }
                    }
                    return row.shareFlag
                case "lastUpdateTm":return this.$format(row.lastUpdateTm, "yyyy/MM/dd hh:mm:ss");  // 修改时间
                case "createTm":return this.$format(row.createTm, "yyyy/MM/dd hh:mm:ss");  // 创建时间
            default : return row[column.property]; 
            }
	    }
    }
}
</script>
<style lang="less">
@import "../common/css/common.less";
.sysSetting{
	.el-collapse-item__header{
		font-weight: bold;
	}
}
</style>
